package io.renren.modules.gengyun.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.gengyun.entity.RecordTimeEntity;
import io.renren.modules.gengyun.service.RecordTimeService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author krlin
 * @email 2032153705@qq.com
 * @date 2020-09-17 20:31:48
 */
@RestController
@RequestMapping("gengyun/recordtime")
public class RecordTimeController {
    @Autowired
    private RecordTimeService recordTimeService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("gengyun:recordtime:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = recordTimeService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("gengyun:recordtime:info")
    public R info(@PathVariable("id") Integer id){
		RecordTimeEntity recordTime = recordTimeService.getById(id);

        return R.ok().put("recordTime", recordTime);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("gengyun:recordtime:save")
    public R save(@RequestBody RecordTimeEntity recordTime){
		recordTimeService.save(recordTime);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("gengyun:recordtime:update")
    public R update(@RequestBody RecordTimeEntity recordTime){
		recordTimeService.updateById(recordTime);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("gengyun:recordtime:delete")
    public R delete(@RequestBody Integer[] ids){
		recordTimeService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
